package com.ninthgroup.service.Impl;

import com.ninthgroup.entity.Admin;
import com.ninthgroup.mapper.AdminMapper;
import com.ninthgroup.service.AdminService;
import com.ninthgroup.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ：1452863884@qq.com rcg
 * @date ：Created in 2022/10/21 12:44
 * @description：管理员实现类
 * @modified By：
 * @version:1.0
 */
@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    private AdminMapper adminMapper;
    @Override
    public Admin login(Admin admin) {
        Admin byAdminnameAndPassword = adminMapper.findByAdminnameAndPassword(admin.getaName(), admin.getaPassword());
        return byAdminnameAndPassword;
    }

    @Override
    public Result findOneById(Integer aId) {
        Admin admin = adminMapper.selectByPrimaryKey(aId);
        return new Result(200,"刷新信息成功",admin);
    }

    @Override
    public Result update(Admin admin) {

        int i = adminMapper.updateByPrimaryKeySelective(admin);
        return new Result(200,"更改成功");
    }
}